home *** CD-ROM | disk | FTP | other *** search
/ LSD Docs / LSD Docs.iso / FILEZ / lsd24.dms / lsd24.adf / PrinterEscape.Sequences.pp / PrinterEscape.Sequences
Text File  |  1990-09-07  |  16KB  |  350 lines

  1. TITLE:  Printer Escape Sequences (LONG)
  2.  
  3. AmigaDOS provides 3 "handlers" which can be used to do I/O to a 
  4. printer. These are "par:", "ser:", and "prt:", referring to
  5. parallel, serial, and printer respectively.  If you want to do 
  6. output to the printer using the file system routines, you will 
  7. Open() one of these and do Write() calls to it.  The CLI commands 
  8. also expect you to use these strings as file parameters.  For 
  9. instance, you can send a file to the printer handler with the 
  10. command  "copy myfile to prt:".  Similarly, you use these handler 
  11. names when trying to write to the printer from languages like 
  12. ABasiC.  (For compatability, Microsoft's Amiga Basic also defines 
  13. LPT1 to be the same as prt:.)
  14.  
  15. An AmigaDOS "handler" is simply a piece of interface code that 
  16. translates the device independent file system calls like Write() 
  17. into the appropriate message traffic to the "devices" implemented 
  18. in Exec, the multi-tasking kernel of the Amiga.  The "par:"
  19. handler uses the device "parallel.device" which is the Exec code 
  20. that manages the parallel port connector on the back of your Amiga.
  21. The "ser:" handler uses the device "serial.device" which manages 
  22. the serial port connector.
  23.  
  24. Simply put, when you do output to par: or ser: you are talking 
  25. straight through to the hardware -- with no intervening levels 
  26. of interpretation. If you have an Okimate 20 printer connected to 
  27. your parallel port, then escape sequences sent to par: will reach 
  28. it directly and will have whatever effect they are defined to have 
  29. by OkiData.
  30.  
  31. Printing to par: or ser: is pretty straightforward.  Keep in mind 
  32. that a standard AmigaDOS text file uses LF as a line separator 
  33. (not CR or CR-LF), and that a file may or may not have an LF at 
  34. the end. You may want to add a carriage-return character to the 
  35. ends of your lines (in a simple program you create), or, if your 
  36. printer offers this option, flip the switch that automatically 
  37. gives you a CR when the printer receives an LF.
  38.  
  39. [NOTE: Input from par: and ser: is somewhat more complex, since 
  40. they do "buffered" I/O -- but I digress.]
  41.  
  42. If you are writing a program, you can avoid all this handler stuff 
  43. by doing an OpenDevice() directly on the Exec device you are 
  44. interested in talking to. You then pass I/O request blocks to the 
  45. device using the I/O calls provided by Exec (DoIO() and friends). 
  46. The advantage of talking directly to the device is that you get a 
  47. lot more flexibility, including things like asynchronous I/O and 
  48. the ability to set device parameters such as serial baud rate.  
  49. For more information on how you call the system library and device 
  50. routines, and just what functions are available, please look in 
  51. the Amiga ROM Kernel Manual [WHICH WILL BE IN THE STORES SHORTLY!].
  52.  
  53. Note that the Preferences tool printer settings have NO EFFECT on 
  54. the function of the par: and ser: handlers!  [Preferences IS, 
  55. however, used to set the default baud rate used by ser:.]  Any 
  56. special function you want your printer to do is UP TO YOU when you 
  57. use par: or ser:.  YOU must choose the correct escape sequences to 
  58. send to do even initialization style functions -- such as setting 
  59. the margins.  Obviously, this obliges you to KNOW what style 
  60. printer is connected to your Amiga and whether it is connected to 
  61. the serial or to the parallel port.
  62.  
  63. Which brings us to prt:.  The prt: handler uses the Exec device 
  64. "printer.device".  The printer device uses the information it 
  65. finds in the Preferences settings to understand the type of 
  66. printer you have connected and how you want it to be used.  On 
  67. the basis of the printer port setting you've made in Preferences, 
  68. the printer device talks to either the serial or the parallel 
  69. device to reach the printer.
  70.  
  71. The printer device understands ONLY ITS OWN, PRINTER INDEPENDENT, 
  72. ESCAPE SEQUENCES.  It converts these escape sequences into the 
  73. printer specific escape sequences appropriate for the printer 
  74. currently selected in Preferences.  In addition, the Initialize 
  75. funcition (which is invoked when you open the printer device or 
  76. when you send it the Initialise escape sequence) causes the 
  77. appropriate escapes to be sent to your printer to configure it 
  78. according to the options you have selected in Preferences.  This, 
  79. for instance, is how your margin settings get sent to the printer.
  80.  
  81. If you use the printer device (or prt:) you can write code which 
  82. is largely independent of the type of printer your customers have 
  83. on their Amigas.  The tables below show the escape sequences 
  84. understood by the printer device and the ones that it knows how 
  85. to translate for each supported printer type.
  86.  
  87. Note that when using the printer device (or prt:), you should 
  88. TURN-OFF any option on your printer providing for an automatic 
  89. CR , LF, or CR-LF to be generated whenever the printer receives an 
  90. LF.  The printer device will provide end of line CR-LFs as needed.
  91.  
  92. Also note that, in addition to the alphnumeric printing described 
  93. here, the printer device provides for black and white, grey-scale, 
  94. and full color, raster-graphics printing.  This function is only 
  95. available when talking directly to the printer device (not from 
  96. prt:).
  97.  
  98. ------------------------Known Bugs:
  99.  
  100. The V1.0 Serial Device (and, thus ser:) does not read reliably at 
  101. the higher baud rates.  Writes work just fine.  The serial device 
  102. uses CTRL-S / CTRL-Q (XON/XOFF) flow control ONLY for V1.0.
  103.  
  104. The V1.0 Printer Device does not correctly interpret length=-1, 
  105. which is supposed to indicate that you've given the printer a 
  106. null terminated string.  Prt: is not affected by this, since the 
  107. handler code always feeds the printer device the correct length.
  108.  
  109. -------------------Printer Device Command Definitions:
  110.  
  111. The table below shows the escape sequences understood by V1.0 
  112. printer.device. The command names or numbers may be used instead 
  113. when sending commands to printer.device. Only the escape 
  114. sequences are useful when talking to prt:.  Note that not all 
  115. printers will implement all commands.  Any unimplemented commands 
  116. are treated as NO-OPs.
  117.  
  118. In the escape sequences, n, n1, and n2 are numeric parameters 
  119. which should appear in your escape sequence as a string of ASCII 
  120. digits (e.g., "123"), NOT as the equivalent binary value!
  121.  
  122.      #define aRIS     0  /* ESCc  reset                      ISO */
  123.      #define aRIN     1  /* ESC#1 initialize                 +++ */
  124.      #define aIND     2  /* ESCD  lf                         ISO */
  125.      #define aNEL     3  /* ESCE  return,lf                  ISO */
  126.      #define aRI      4  /* ESCM  reverse lf                 ISO */
  127.      #define aSGR0    5  /* ESC[0m normal char set           ISO */
  128.      #define aSGR3    6  /* ESC[3m italics on                ISO */
  129.      #define aSGR23   7  /* ESC[23m italics off              ISO */
  130.      #define aSGR4    8  /* ESC[4m underline on              ISO */
  131.      #define aSGR24   9  /* ESC[24m underline off            ISO */
  132.      #define aSGR1   10  /* ESC[1m boldface on               ISO */
  133.      #define aSGR22  11  /* ESC[22m boldface off             ISO */
  134.      #define aSFC    12  /* SGR30-39  set foreground color   ISO */
  135.      #define aSBC    13  /* SGR40-49  set background color   ISO */
  136.      #define aSHORP0 14  /* ESC[0w normal pitch              DEC */
  137.      #define aSHORP2 15  /* ESC[2w elite on                  DEC */
  138.      #define aSHORP1 16  /* ESC[1w elite off                 DEC */
  139.      #define aSHORP4 17  /* ESC[4w condensed fine on         DEC */
  140.      #define aSHORP3 18  /* ESC[3w condensed off             DEC */
  141.      #define aSHORP6 19  /* ESC[6w enlarged on               DEC */
  142.      #define aSHORP5 20  /* ESC[5w enlarged off              DEC */
  143.      #define aDEN6   21  /* ESC[6"z shadow print on          DEC */
  144.      #define aDEN5   22  /* ESC[5"z shadow print off         DEC */
  145.      #define aDEN4   23  /* ESC[4"z doublestrike on          DEC */
  146.      #define aDEN3   24  /* ESC[3"z doublestrike off         DEC */
  147.      #define aDEN2   25  /* ESC[2"z  NLQ on                  DEC */
  148.      #define aDEN1   26  /* ESC[1"z  NLQ off                 DEC */
  149.      #define aSUS2   27  /* ESC[2v superscript on            +++ */
  150.      #define aSUS1   28  /* ESC[1v superscript off           +++ */
  151.      #define aSUS4   29  /* ESC[4v subscript on              +++ */
  152.      #define aSUS3   30  /* ESC[3v subscript off             +++ */
  153.      #define aSUS0   31  /* ESC[0v normalize the line        +++ */
  154.      #define aPLU    32  /* ESCL  partial line up            ISO */
  155.      #define aPLD    33  /* ESCK  partial line down          ISO */
  156.      #define aFNT0   34  /* ESC(B US char set                DEC */
  157.      #define aFNT1   35  /* ESC(R French char set            DEC */
  158.      #define aFNT2   36  /* ESC(K German char set            DEC */
  159.      #define aFNT3   37  /* ESC(A UK char set                DEC */
  160.      #define aFNT4   38  /* ESC(E Danish I char set          DEC */
  161.      #define aFNT5   39  /* ESC(H Sweden char set            DEC */
  162.      #define aFNT6   40  /* ESC(Y Italian char set           DEC */
  163.      #define aFNT7   41  /* ESC(Z Spanish char set           DEC */
  164.      #define aFNT8   42  /* ESC(J Japanese char set          +++ */
  165.      #define aFNT9   43  /* ESC(6 Norweign char set          DEC */
  166.      #define aFNT10  44  /* ESC(C Danish II char set         +++ */
  167.      #define aPROP2  45  /* ESC[2p  proportional on          +++ */
  168.      #define aPROP1  46  /* ESC[1p  proportional off         +++ */
  169.      #define aPROP0  47  /* ESC[0p  proportional clear       +++ */
  170.      #define aTSS    48  /* ESC[n E set proportional offset  ISO */
  171.      #define aJFY5   49  /* ESC[5 F auto left justify        ISO */
  172.      #define aJFY7   50  /* ESC[7 F auto right justify       ISO */
  173.      #define aJFY6   51  /* ESC[6 F auto full justify        ISO */
  174.      #define aJFY0   52  /* ESC[0 F auto justify off         ISO */
  175.      #define aJFY3   53  /* ESC[3 F letter space (justify)   ISO */
  176.      #define aJFY1   54  /* ESC[1 F word fill(auto center)   ISO */
  177.      #define aVERP0  55  /* ESC[0z  1/8" line spacing        +++ */
  178.      #define aVERP1  56  /* ESC[1z  1/6" line spacing        +++ */
  179.      #define aSLPP   57  /* ESC[nt  set form length n        DEC */
  180.      #define aPERF   58  /* ESC[nq  perf skip n (n>0)        +++ */
  181.      #define aPERF0  59  /* ESC[0q  perf skip off            +++ */
  182.      #define aLMS    60  /* ESC#9   Left margin set          +++ */
  183.      #define aRMS    61  /* ESC#0   Right margin set         +++ */
  184.      #define aTMS    62  /* ESC#8   Top margin set           +++ */
  185.      #define aBMS    63  /* ESC#2   Bottom marg set          +++ */
  186.      #define aSTBM   64  /* ESC[Pn1;Pn2r  T&B margins        DEC */
  187.      #define aSLRM   65  /* ESC[Pn1;Pn2s  L&R margin         DEC */
  188.      #define aCAM    66  /* ESC#3   Clear margins            +++ */
  189.      #define aHTS    67  /* ESCH    Set horiz tab            ISO */
  190.      #define aVTS    68  /* ESCJ    Set vertical tabs        ISO */
  191.      #define aTBC0   69  /* ESC[0g  Clr horiz tab            ISO */
  192.      #define aTBC3   70  /* ESC[3g  Clear all h tab          ISO */
  193.      #define aTBC1   71  /* ESC[1g  Clr vertical tabs        ISO */
  194.      #define aTBC4   72  /* ESC[4g  Clr all v tabs           ISO */
  195.      #define aTBCALL 73  /* ESC#4   Clr all h & v tabs       +++ */
  196.      #define aTBSALL 74  /* ESC#5   Set default tabs         +++ */
  197.      #define aEXTEND 75  /* ESC[Pn"x extended commands       +++ */
  198.  
  199. ----------------------Printer Functions Implemented:
  200.  
  201. The following tables tell which of the printer device escape 
  202. sequences are implemented for each of the printers supported in 
  203. the V1.0 release.  Any unimplemented escape sequence is ignored.
  204.  
  205.  
  206. NAME: Alphacom AlphaPro101
  207.     functions implemented: 
  208.  
  209.     aRIS, aIND, aNEL, aRI, aSGR0, aSGR4, aSGR24, aSGR1, aSGR22, 
  210.     aSHORP0, aSHORP1, aSHORP2, aSHORP3, aSHORP4, aDEN3, aDEN4, 
  211.     aDEN5, aDEN6, aVERP0, aVERP1, aSLPP, aLMS, aRMS, aTMS, aBMS 
  212.  
  213.     special functions implemented:
  214.  
  215.     aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4, aSLRM, aSFC, aCAM
  216.  
  217.  
  218. NAME: Brother_HL-15XL 
  219.     functions implemented: 
  220.  
  221.     aRIS, aIND, aNEL, aRI, aSGR0, aSGR4, aSGR24, aSGR1, aSGR22, 
  222.     aSHORP0, aSHORP1, aSHORP2, aSHORP3, aSHORP4, aDEN3, aDEN4, 
  223.     aDEN5, aDEN6, aPROP0, aPROP1, aPROP2, aTSS, aVERP0, aVERP1, 
  224.     aSLPP, aLMS, aRMS, aTMS, aBMS, aCAM, aHTS, aVTS, aTBC0, 
  225.     aTBC3, aTBC4, aTBCALL, aTBSALL
  226.  
  227.     special functions implemented:
  228.  
  229.     aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4, aPLU, aPLD, aSLRM
  230.  
  231.  
  232. NAME: CBM MPS-1000 
  233.     functions implemented: 
  234.  
  235.     aRIS, aIND, aNEL, aSGR0, aSGR4, aSGR24, aSGR1,aSGR22, 
  236.     aSHORP0, aSHORP1, aSHORP2, aSHORP3, aSHORP4,aSHORP5, 
  237.     aSHORP6, aDEN1, aDEN2, aDEN3, aDEN4, aSUS0, aSUS1,aSUS2, 
  238.     aSUS3, aSUS4, aFNT0, aFNT1, aFNT2, aFNT3, aFNT4, aFNT5, 
  239.     aFNT6, aFNT7, aFNT8 aFNT9, aFNT10, aPROP1, aPROP2,aJFY6, 
  240.     aJFY0, aVERP0, aVERP1, aSLPP, aPERF, aPERF0, aTBC3, 
  241.     aTBC4, aTBCALL, aTBSALL 
  242.  
  243.     special functions implemented:
  244.  
  245.     aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4, aCAM, aPLU, aPLD, 
  246.     aVERP0, aVERP1, aSLRM, aIND
  247.  
  248.  
  249. NAME: Diablo 630 
  250.     functions implemented: 
  251.  
  252.     aRIS, aIND, aNEL, aRI, aSGR0, aSGR4, aSGR24, aSGR1, aSGR22, 
  253.     aSHORP0, aSHORP1, aSHORP2, aSHORP3, aSHORP4, aDEN3, aDEN4, 
  254.     aDEN5, aDEN6, aPLU, aPLDaPROP0, aPROP1, aPROP2, aTSS, aJFY5, 
  255.     aJFY0, aJFY1, aVERP0, aVERP1, aSLPP, aLMS, aRMS, aTMS, aBMS, 
  256.     aCAM, aHTS, aVTS, aTBC0, aTBC3, aTBC1, aTBCALL, aTBSALL
  257.  
  258.     special functions implemented:
  259.  
  260.     aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4,aSLRM, aSFC
  261.  
  262.  
  263. NAME: Diablo Advantage D25 
  264.     functions implemented: 
  265.  
  266.     aRIS, aIND, aNEL, aRI, aSGR0, aSGR4, aSGR24, aSGR1, aSGR22, 
  267.     aSHORP0, aSHORP1, aSHORP2, aSHORP3, aSHORP4, aDEN3, aDEN4, 
  268.     aDEN5, aDEN6, aPLU, aPLD,aPROP0, aPROP1, aPROP2, aTSS, 
  269.     aJFY5, aJFY0, aVERP0, aVERP1, aSLPP, aLMS, aRMS, aTMS, 
  270.     aBMS, aCAM, aHTS, aVTS, aTBC0, aTBC3, aTBC1, aTBCALL, 
  271.     aTBSALL
  272.  
  273.     special functions implemented:
  274.  
  275.     aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4, aPLU, aPLD, aSLRM, aSFC
  276.  
  277.  
  278. NAME: Diablo C-150 
  279.     functions implemented: 
  280.  
  281.     aRIS, aIND, aNEL, aSLPP, aLMS, aRMS,aHTS, aTBC0, aTBC3, 
  282.     aTBCALL, aTBSALL
  283.  
  284.     special functions implemented:
  285.  
  286.     aRIN, aSLRM, aSFC
  287.  
  288.  
  289. NAME: Epson X-80 
  290.     functions implemented: 
  291.  
  292.     aRIS, aIND, aNEL, aSGR0, aSGR3, aSGR23, aSGR4, aSGR24, 
  293.     aSGR1, aSGR22, aSHORP0, aSHORP1, aSHORP2, aSHORP3, 
  294.     aSHORP4, aSHORP5, aSHORP6, aDEN1, aDEN2, aDEN3, aDEN4, 
  295.     aSUS0, aSUS1, aSUS2, aSUS3, aSUS4,aFNT0, aFNT1, aFNT2, 
  296.     aFNT3, aFNT4, aFNT5, aFNT6, aFNT7, aFNT8, aFNT9, aFNT10,
  297.     aPROP1, aPROP2, aJFY5, aJFY7, aJFY6, aJFY0, aJFY3, aJFY2,
  298.     aVERP0, aVERP1, aSLPP, aPERF, aPERF0, aTBC3, aTBC4, 
  299.     aTBCALL, aTBSALL 
  300.  
  301.     special functions implemented:
  302.  
  303.     aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4, aPLU, aPLD, aVERP0, 
  304.     aVERP1, aSLRM, aIND, aCAM
  305.  
  306.  
  307. NAME: Epson JX-80 
  308.     functions implemented: 
  309.  
  310.     aRIS, aIND, aNEL, aSGR0, aSGR3, aSGR23, aSGR4, aSGR24, 
  311.     aSGR1, aSGR22, aSHORP0, aSHORP1, aSHORP2, aSHORP3, 
  312.     aSHORP4, aSHORP5, aSHORP6, aDEN1, aDEN2, aDEN3, aDEN4, 
  313.     aSUS0, aSUS1, aSUS2, aSUS3, aSUS4,aFNT0, aFNT1, aFNT2, 
  314.     aFNT3, aFNT4, aFNT5, aFNT6, aFNT7, aFNT8, aFNT9, aFNT10, 
  315.     aPROP1, aPROP2, aJFY5, aJFY7, aJFY6, aJFY0, aJFY3, aJFY2,
  316.     aVERP0, aVERP1, aSLPP, aPERF, aPERF0, aTBC3,aTBC4, 
  317.     aTBCALL, aTBSALL
  318.  
  319.     special functions implemented:
  320.  
  321.     aRIN, aRI, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4, aCAM aPLU, 
  322.     aPLD, aVERP0, aVERP1, aSLRM, aIND, aSFC
  323.  
  324.  
  325. NAME: Okimate 20 
  326.     functions implemented: 
  327.  
  328.     aRIS, aIND, aNEL, aSGR0, aSGR3, aSGR23, aSGR4, aSGR24, 
  329.     aSHORP0, aSHORP1, aSHORP2, aSHORP3, aSHORP4, aSHORP5, 
  330.     aSHORP6, aDEN1, aDEN2, aSUS0, aSUS1, aSUS2, aSUS3, 
  331.     aSUS4, aVERP0, aVERP1, aSLPP, aPERF, aPERF0
  332.  
  333.     special functions implemented:
  334.  
  335.     aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4, aPLU, aPLD
  336.  
  337.  
  338. NAME: Qume LetterPro 20 
  339.     functions implemented: 
  340.  
  341.     aRIS, aIND, aNEL, aRI, aSGR0, aSGR4, aSGR24, aSGR1, aSGR22, 
  342.     aSHORP0, aSHORP1, aSHORP2, aSHORP3, aSHORP4, aDEN3, aDEN4, 
  343.     aDEN5, aDEN6, aPLU, aPLD,aPROP0, aPROP1, aPROP2, aTSS, 
  344.     aVERP0, aVERP1, aSLPP, aLMS, aRMS, aCAM
  345.  
  346.     special functions implemented:
  347.  
  348.     aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4, aPLU, aPLD, aSLRM, 
  349.     aSLPP, aSFC
  350.